<?php use_javascript("/sfDoctrinePlugin/css/global.css"); ?>
<?php use_javascript("/sfDoctrinePlugin/css/default.css"); ?>
<?php use_javascript("/css/main.css"); ?>

<div id="sf_admin_container">
	<?php use_helper('I18N', 'Date') ?>
	<h1 id="topH1"> <?php echo $subject->getTitleSjt()?> </h1>
	
	<div>
		<div class="small-title">R&eacute;sum&eacute;:</div>
		<span class="smallcontent"><?php echo $subject->getSummarySjt()?></span> 
	</div>
	<?php if ($subject->getArticleSjt()):?> 
	<div>
		<div class="small-title">Contenu:</div>
		<span class="smallcontent"><?php echo $subject->getArticleSjt()?></span>
	</div>
	<?php endif?>
	<?php if($subject->getLinkSjt()):?> 
	<div>
		<?php echo $subject->getLinkSjt()?> 
	</div>
	<?php endif;?>
	
	
	<div id="authors">Liste des auteurs ayants contribué à ce sujet</div>
	
	<div id="sf_admin_content" class="smallmarg">
	<?php if(count($subject->getAuthor()) > 0):?>
    <form action="<?php echo url_for('@author', array('action' => 'batch')) ?>" method="post">
	 <table>
	  <tbody>
	    
	    <tr>
	      <th>Nom</th>
	      <th>Pr&eacute;nom</th>
	    </tr>
	    <?php foreach ($subject->getAuthor() as $author):?>
	    <tr>
	      <td><?php echo $author->getLastnamePer() ?></td>
	      <td><?php echo $author->getFirstnamePer() ?></td>
	    </tr>
	    <?php endforeach;?>
	  </tbody>
	</table>
  </form>
  <?php else :?>
	<div>
		Aucun auteur
	</div>
	<?php endif;?>
  <div id="authors">Liste des commentaires </div>
	
	<?php if(count($subject->getComments()) > 0):?>
	<div id="sf_admin_content">
		    <?php foreach ($subject->getComments() as $comment):?>
		    <div class="comment">
		      <div class="wrote-by">&Eacute;crit par:&nbsp;<?php echo $comment->getPerson(); ?></div>
		      <div class="inner-comment">
		      	<?php echo $comment->getTextCmt(); ?>
		      </div>
		    </div>
		    <?php endforeach;?>
	</div>
	<?php else :?>
	<div>
		Aucun commentaire
	</div>
	<?php endif;?>
</div>

  <div id="add_post">
  	  Ajouter un nouveau commentaire:
	  <form action="<?php echo url_for('@comment', array('action' => 'new')) ?>" method="post">
		 <textarea rows="15" cols="60" name="comment[text_cmt]"></textarea>
		 <input type="hidden" name="comment[subject_id]" value="<?php echo $subject->getId()?>"/ >
		 <input type="hidden" name="comment[person_id]" value="<?php echo $sf_user->getPerson()->getId()?>"/ >
		 <div><input type="submit"/ class="csubmit"></div>
		 <div style="clear:both"></div>
	  </form>
  </div>
<hr />

<a href="<?php echo url_for('subject/edit?id='.$subject->getId()) ?>">&Eacute;diter</a>
&nbsp;
<a href="<?php echo url_for('subject/index') ?>">Retour vers la liste</a>
</div>